<form class="layui-form layui-form-pane" id="refundform"  lay-filter="refundform">
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline"  style="width:470px">
                <label class="layui-form-label" style="width:140px">交易id</label>
                <div class="layui-form-label" style="width:300px">
                    ${refund.transactionId}
                </div>
                <input type="hidden" name="transactionId" value="${refund.transactionId}"/>
            </div>
            <div class="layui-inline" style="width:470px">
                <label class="layui-form-label"  style="width:140px">支付方式</label>
                <div class="layui-form-label" style="width:300px">
                    ${refund.payMethodText}
                </div>
            </div>
            <div class="layui-inline" style="width:470px">
                <label class="layui-form-label"  style="width:140px">订单总金额(分)</label>
                <div class="layui-form-label" style="width:300px">
                    ${refund.totalMoney}
                </div>
            </div>
            <div class="layui-inline" style="width:470px">
                <label class="layui-form-label" style="width:140px">已退还金额(分)</label>
                <div class="layui-form-label" style="width:300px">
                    ${refund.refundMoney}
                </div>
            </div>
            <div class="layui-inline" style="width:470px">
                <label class="layui-form-label" style="width:140px">本次退款金额(分)</label>
                <div class="layui-input-inline" style="width:300px">
                    <input type="text" name="refundMoney" id="refundMoney" autocomplete="off" class="layui-input" lay-verify="required|number" value="${refund.totalMoney-refund.refundMoney}">
                </div>
            </div>
            <div class="layui-inline" style="width:470px">
                <label class="layui-form-label" style="width:140px">退款原因</label>
                <div class="layui-input-inline" style="width:300px">
                    <textarea name="reason" id="reason" class="textarea" lay-verify="required" rows="6" cols="40" ></textarea>
                </div>
            </div>
        </div>
    </div>
<script language="JavaScript">
    function refundMoney() {
    <!--# if(isEmpty(errorMsg)) { -->
        if (!checkRefund()) {
            return;
        }
        postUrl = "/trans/finTransaction/refund.json";
        Lib.submitForm(postUrl,$("#refundform"),{},
            function() {
                layer.close(layer.index);
                Common.info("退款操作完成。");
                setTimeout(dataReload(),3000);
            }
        );
    <!--# } else { -->
        Lib.closeFrame();
        Common.info("不能退款,${errorMsg}");
    <!--# } -->
    }
    function checkRefund() {
        var refundMoney = $("#refundMoney").val();
        var maxMoney = ${refund.totalMoney-refund.refundMoney};
        if (refundMoney=="" || isNaN(refundMoney) || refundMoney<1 || refundMoney> maxMoney) {
            Common.info("请输入本次退款金额,1~"+maxMoney);
            return false;
        }
        if ($("#reason").val()=="") {
            Common.info("请输入退款原因。");
            return false;
        }
        return true;
    }
</script>
</form>